{include file="public/adminhead"}

<div class="container-fluid p-t-15">
  
  <div class="row">
    <div class="col-lg-12">
      <div class="card">
        <div class="card-body">

          <form class="form-horizontal" action="#" method="post" enctype="multipart/form-data" onsubmit="return false;">
            {notempty name='$res'}<input type="hidden" name="id" value="{$res.id}">{/notempty}

            <div class="form-group">
              <div class="col-xs-12">
                <input type="text" class="form-control" placeholder="模型标题" name="name" value="{notempty name='$res'}{$res.name}{/notempty}">
              </div>
            </div>

            <div class="form-group">
              <div class="col-xs-12">
                <textarea class="form-control" id="example-textarea-input" name="intro" rows="6" placeholder="简介..">{notempty name='$res'}{$res.intro}{/notempty}</textarea>
              </div>
            </div>


            <div class="form-group">
              <div class="col-xs-12">
                <button class="btn btn-primary" type="button" id="submit">提交</button>
              </div>
            </div>
          </form>

        </div>
      </div>
    </div>
    </div>
  </div>
  
</div>
{include file="public/afooter"}

<script>
  $("#submit").click(function () {
    var data = $("form").serialize();
    var url = "{:url('save')}"
    $.post(url,data,function (e) {
      if(e.code != 200){
        error(e.msg);
      }else {
        success(e.msg);
        var index = parent.layer.getFrameIndex(window.name);
        setTimeout(function(){parent.layer.close(index)}, 1000);
        window.parent.location.reload();
      }
    })
  })
</script>